package com.chuangjiangx.member.coupon.ddd.domain.model;

/**
 * Created by Lenovo on 2018/8/28.
 */
public enum WxUserCardStatus {
    NORMAL("正常","NORMAL"),
    CONSUMED("已核销","CONSUMED"),
    EXPIRE ("已过期","EXPIRE"),
    GIFTING ("转赠中","GIFTING"),
    GIFT_TIMEOUT ("转赠超时","GIFT_TIMEOUT"),
    DELETE ("已删除","DELETE"),
    UNAVAILABLE ("已失效","UNAVAILABLE");

    public final String name;
    public final String code;

    WxUserCardStatus(String name, String code) {
        this.name = name;
        this.code = code;
    }

    public static WxUserCardStatus get(String code){
        for(WxUserCardStatus type : values()){
            if(type.code.equals(code)){
                return type;
            }
        }
        return null;
    }
}
